package jhub.text;

import java.text.MessageFormat;
import java.text.ParseException;

import jhub.DCProtocol;

public class HelloMessage extends DCRawCommand{
    
    public static HelloMessage getInstance(String nick) throws ParseException{
        return new HelloMessage(MessageFormat.format(DCProtocol.HELLO_FORMAT,nick));
    }
    
    private String nick;
    
    private HelloMessage(String command) throws ParseException {
        super(command);
        parse();
    }
    
    private void parse() throws ParseException{
        Object[] o = new MessageFormat(DCProtocol.HELLO_FORMAT).parse(command.toString());
        setNick(o[0].toString());
    }

    public String getNick() {
        return nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }
    
    
}
